package com.changgou.search.canal;

import com.changgou.search.canal.conf.RabbitMqConfig;
import com.changgou.search.service.ESManagerService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

//监听下架
@Component
public class GoodsDelListener {

    @Autowired
    private ESManagerService esManagerService;

    //监听商品下架队列
    @RabbitListener(queues = RabbitMqConfig.SEARCH_DEL_QUEUE)
    public void GoodsDelListener(String spuId){
        System.out.println("监听到有商品下架了 SpuId为 : " +spuId);
        esManagerService.delDataBySpuId(spuId);
        System.out.println("ES对应商品信息删除成功");
    }


}
